#!/usr/bin/env python
# -*- coding: utf_8 -*-

#    guteninja: a frontend for various video-games
#    Copyright (C) 2007  Tor-björn Claesson

#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.

#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
import os

class gamesystem:
    def _get_name(self):
        return self._name
    def _set_name(self, name):
        self._name = name
    name = property(_get_name, _set_name)
    
    def __init__(self, name=None):
        self.name = name
    
    def run(self, game=None):
        pass

class native(gamesystem):
    def __init__(self):
       self.name = "native"
    def run(self, game=None):
        if game == None: 
            return None
        os.system('ipacutil -c ' + game.path + game.buttons)
        os.system(path + game.romefile + ' ' + game.args)

class dos(gamesystem):
    def __init__(self):
        self.name = "dos"
    def run(self, game=None):
        if game == None:
            return None
        os.system('ipacutil -c ' + game.path + game.buttons)
        os.system('dosbox ' + game.path + game.romfile + ' -fullscreen -exit')
    
class nes(gamesystem):
    def __init__(self):
        self.name = "nes"
    def run(self, game=None):
        if game == None:
            return None
        os.system('ipacutil -c ' + game.path + 'nes/nes.cfg')
        os.system('fceu -fs 1 ' + game.path + game.romfile)

class snes(gamesystem):
    def __init__(self):
        self.name = "snes"
    def run(self, game=None):
        if game == None:
            return None
        os.system('ipacutil -c ' + game.path + 'snes/snes.cfg')
        os.system('snes9x -fs ' + game.path + game.romfile)
